package com.ruoyi.framework.web.service.api;

import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.user.CaptchaException;
import com.ruoyi.common.exception.user.CaptchaExpireException;
import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 登录校验方法
 * 
 * @author ruoyi
 */
@Component
public class ApiLoginService
{



    @Autowired
    private RedisCache redisCache;
    
    @Autowired
    private ISysUserService userService;

    public SysUser selectBusinesTUserByPfOpenId(String openid) {
        return  userService.selectBusinesTUserByPfOpenId(openid);
    }

    public SysUser selectUserByUserName(String phone) {
        return  userService.selectUserByUserName(phone);
    }

    public int updateUserProfile(SysUser businesTUser) {
      return   userService.updateUserProfile(businesTUser);
    }

    public void registerUser(SysUser businesTUser) {
        userService.registerUser(businesTUser);
    }

    public String checkPhoneUnique(String phone) {
        return  userService.checkUserNameUnique(phone);
    }

    public SysUser selectTUserById(Long userId) {
        return  userService.selectUserById(userId);
    }
}
